#!/bin/bash
#刷新交换分区内容回硬盘并重开交换分区

### Description:
###     Flash — refesh PC Swap space on Linux
###
### Date: 2020.07.09
### Author: Shieber
### Email: QMH_XB_FLTMY@yahoo.com
###
### Usage:
###     Flash <password>
###
### Options:
###     <password>  Input your sudo password
###     -h,--help   Show help message.
###
###
### Example:
###     Flash my-password
help() {
    sed -rn 's/^### ?//;T;p' "$0"
}


if [[ "$1" == "-h" ]] || [[ "$1" == "--help" ]]; then
    help
    exit 1
else
    sudo swapoff -a
    sudo swapon -a
    echo "Swap cleaned"
fi
